Thumbnailer, v 1.6
©1995,1996, Preston Holmes
The current version of this document may be found at:
http://salk.edu/~preston/as/thumbnailer.html
This applescript droplet will batch process PICT, JPEG, or GIF files into thumbnails and full size images for use in HTML pages. It uses the great program clip2gif by Yves Piguet (piguet@ia.epfl.ch) as its conversion engine. Thumbnailer also writes an HTML index that can be used in cutting and pasting the HTML directly into your HTML documents.
This script is freely distributable for all non-commercial use.
Requirements
- Mac OS 7.5 (or earlier versions if you have the scriptable finder)
- clip2gif version 0.7 or later
- ACME Script Widgets OSAX
Getting the pieces:
What it does
Thumbnailer is an applescript droplet that will accept PICT, JPEG, or GIF files. It will then do the following three basic things (with a number of configurable parameters):
- Create subfolders for images
- Convert the source file into a full sized image (either JPEG or GIF) and create a scaled thumbnail for it (Using clip2gif).
- Write an HTML file that indexes the images with thumbnails linked to the full sized graphics.
Optionally Thumbnailer can also put the images in Tables and have the full sized images be on their own "Caption Page". See the section "Configuring Thumbnailer" for more information on setting options. If you are having problems check the section on known problems. You also can look at some examples of the output
How to use it:
When you first get thumbnailer, it is set up to use a standard configuration which will work for many people. There are a many other goodies you can set (as well as change most of the defaults), but I'll cover the basic operation assuming use of the defaults first.
Start by scanning in or saving your image files as PICT, JPEG, or GIF, for Thumbnailer to work properly they must end in ".pict", ".gif", or ".jpg" but should otherwise not have a period in the name. The file names should also not have any special characters including (:,",$,%,\). You may drag source files from anywhere on your hard drive onto Thumbnailer to be converted (they will be moved into a "sources" subfolder during conversion by default).
Thumbnailer will first prompt you for a place to put the subfolders: {"sources","gifs","jpgs"}, I'll call this location the Project Folder. Thumbnailer will then convert each dropped File into a GIF thumbnail (scaled to 30%) and a full sized JPEG and place these in the appropriate subfolders of the Project Folder, and will also move the dropped file into the "sources" subfolder.
In addition an HTML file will be written that containing the HTML for the thumbnails linked to the full sized images. If you want to convert more files after the initial conversion, just drop them on Thumbnailer and they will be added to the collection (in the Project Folder that you choose). When you have a sense of basic operation, look at the section on advanced usage.
Look at this outline of a sample project folder
Also take a look at these examples.
Since the "image-index.html" index written by Thumbnailer uses relative URLs for the pictures, the HTML can be copied and pasted from the index into your own HTML file as long as it resides in the same project folder. The project folder can be moved and the relative links will still work.
Another tip: You can end up with ready to use HTML if you name your files thoughtfully. The filename (minus any extension) is used for:
- ALT tags
- Captions under tables (In index)
- Title and header of caption pages
Therefore it is better to name a PICT file "Me and George" than "MandG". Remember not to use special characters, though spaces are OK and will be converted to underscores for use in final file names.
Thumbnailer is designed to be usable and useful "out of the box" but many of its most interesting features are turned off by default. Configuration parameters are stored in a Config file. By default this file is named "Thumbnailer.config" Multiple config files can be kept and used if they are given different names. Configuration files are text files and can be edited manually or by using the included "Configure Thumbnailer" program. Here is the order of what both "Thumbnailer" and "Configure Thumbnailer" look for when using config files:
- A file with the name "Thumbnailer.config" is looked for in the same folder as the application
- If one is not found the preferences folder is checked
- If "Thumbnailer.config" is not found the program will ask if you would like to locate one, and the "Configure Thumbnailer" program will also offer to create a new one (In the application folder)
Any config file (of any name) can also be dropped onto either application.
To edit the configuration file using "Configure Thumbnailer" double click on the application. To edit an alternative config file drop it onto the Configure program.
Here is a guide to the options available:
- Image type to use for thumbnails? (GIF, JPEG)
- GIF This is still the recomended type until more browsers support Inline JPEGs.
- JPEG Better compression for larger thumbnails, but not universal support.
- Quality of JPEG to use for JPEG thumbnails (Low, Normal, High) quality of the JPEG thumbnails.
- Use HEIGHT and WIDTH tags (Yes or No) Highly recomended, allows some browsers to speed up layout of a page.
- Use ALT tags? (Yes, No) Writes the ALT tags with the filename minus extension as the content. (ie for tree.pict it would be ALT="tree")
- Use ALIGN tags? (No, Yes, choose type) writes an alignment option for all thumbnails.
- Choose ALIGN type: (left,right...etc) These are the alignment tags supported by Netscape, not all browsers will support all tags. For more on these tags look at Netscape's extensions information.
- Amount to scale thumbnails in percent (default is 30%)
- Save full size images as? (JPEG, GIF)
- JPEG Better compresion, good for most photos and graphics, supports up to 24 bit color.
- Full size JPEG quality? (Low, Normal, High) Normal should be fine for most images including photos.
- GIF Larger file size, but better for line drawings, or precision graphics as it avoids the "lossy" compresion of JPEGs.
- Amount to scale full sized images?(0-100%) if your source files are larger than you want your Web full sized images to be you can scale them.
- Stamp thumnails with size in K of full sized image?: (No, Yes) Stamps the thumbnail with the file size (in K) of the full sized image (also is included in ALT tag)
- Upper or Lower Left corner - Which corner for the stamped text
- Stamp Full Sized images with text? (No, Yes) Stamp the image with some text. The font is 9 point Geneva though this can be edited in the script. Useful for copyright stamping.
- Text to stamp with? The string to stamp on the photos
(ie "©1995 Your Name")
- Upper or Lower Left corner - Which corner for the stamped text
- Write seperate HTML 'caption' files for full sized images? (No, Yes) This option links the thumbnail to an HTML file that contains the full sized image as an inlined image. This lets you write information about the image that can be read when the image is visable. A special link is (by default) include for users that don't have inline jpeg support. An additional subfolder "captions" will be created for these files. See the advanced usage section for more information about caption pages.
- Choose a template file for caption pages or use default? (Choose,Default) Choosing Default uses the builtin Caption Page layout. If you choose to make your own caption page template see the section on advanced use.
- Link thumnails to Full Sized images with 'target' parameter? (Yes,No) The target parameter will cause Nescape (and only Netscape) to create a new window which will display all of the full sized images or Caption Pages. Can also be used with Frames. For more info see Netscapes Documentation and the section on advanced use.
- Use Tables around images (providing framed look)? (No, Yes) This puts images in tables (currently only Netscape) Provides a nice frame like appearance. Frames are disabled for the image-index if ALIGN tags are selected because Netscape will not draw the tables correctly with ALIGN tags present. In the image-index file the table HTML is not designed to be copied and pasted, but only used in the index file (let me know if you think this should be otherwise)
- Destination for subfolders and images? (Prompt, Desktop) Defines whether Thumbnailer prompts the user for a Project Folder or uses a folder titled "thumbnailer temp" on the desktop. If they do not exist, the relevant subfolders will be created.
- Move, Copy, or Leave the dropped Files? (Move, Copy, Leave) What to do with the Dropped files. If Move or Copy is chosen a "sources" subfolder will be created for these files. If Move is selected, and the destination is on another volume the file will be copied
- When done with Batch? (Beep, Open Image-Index, Do Nothing) What to do when Thumbnailer is done with a batch of dropped files. The way the script is written you need Netscape to automatically open the the Image-Index. If you want to change this you must edit the creator type the file is created with in the script.
- Quit when done, or stay open till quit manually? (Quit, Stay Open) What to do after the above. This was added because the script is slow to start and quit. If you process several batches in a sitting, it is better to have the script stay open.
Thumbnailer will use the "Thumbnailer.config" file by default if it is found in one of the two standard places. If not you will be asked to locate a config file. To configure Thumbnailer with any config file simply drop it onto Thumbnailer.
See some examples of the variety you can get
Some functionality of Thumbnailer is not apparent at first. This section will introduce you to some of these uses.
Multiple config files
If you regularly work on several projects at the same time each of which has its own configurations, you can keep a seperate config file for each project. Simply make a copy of the "Thumbnailer.config" file and name it something else. To edit it drag it onto the "Configure Thumbnailer" app. To configure Thumbnailer with a given config file simply drop it onto Thumbnailer. If you have set Thumbnailer not to quit, it can be reconfigured by dropping additional config files on it. As a shortcut, a config file can be dropped at the same time as image files and those (and subsequent image files) will be configured with those parameters.
Manually editing config files
Although all options in a config file can be set with the "Configure Thumbnailer" program, editing config files by hand can be speedy and efficient in some situations. This can be done in any text editor. Available entries for each parameter are listed after the commented description of the parameter in the config file. Any additional comments you make in the config file will be erased if later edited using "Configure Thumbnailer".
Using caption pages and editing caption templates
One feature I personally like is the ability of Thumbnailer to create caption pages. Instead of linking the thumbnail to only the full sized image, thumbnails are linked to an HTML document that contains the full sized image as an inlined document. This is most usable by browser which support inlined images though a link to the image file itself can easily be provided. The advantage of caption pages is that a description can appear with the full sized image. The layout of the basic caption page is built into Thumbnailer, and the HTML can be edited once generated. However, you can also have multiple Caption page templates. Which template Thumbnailer uses is set in the config file. The template should include the three following markers which can appear multiple times in the template:
- #imagename# This is replaced with the bare file name (name minus .extension)
- #image# This is replaced with the HTML for the full sized image
- #imageLink# If the full size type is JPEG then a link to the image file will be provided
Take a look at the included sample template, which is identical to the builtin caption page layout used by Thumbnailer.
Using Targets (Netscape only)
The target paramter is a Netscape addition to the Anchor tag. You can use it to target a link (in this case a full sized image or caption page) into a specific window or frame. The target is given a name and in this case the name of the target is "ThumbTarget". A new window will be created and all subsequent loading of full sized images will be targeted into that window (or frame) Targets can also be used in frames. See Netscape's documentation for more information on the use of the target parameter.
Thumbnailer is Drop-Me-A-Line-Ware, if you find it useful drop me a line.
I've done my best to try Thumbnailer under a variety of situations but there are just too many permutations. If you have any trouble please get in touch with me.
- Thumbnailer relies on clip2gif for converting images, currently:
- NOTE: clip2gif's default memory size is not enough for most thumbnailing uses, if you are getting out of memory errors try increasing it to at least 1000K.
- Stamped text can only be put in the upper or lower left corner.
- Aliases are resolved when dropped before Thumbnailer sees them. Therefore the filename of the orignial not the alias is used.
- Alignment tags and tables can not be used at the same time
- If you use table tags around the image in a caption page template, don't turn them on in the config file.
- I've gotten occasional type I errors which must be due to an OSAX though I don't know which one. If you run into this problem restart before using Thumbnailer again.
Version History
Changes made...
New in 1.6
- New configuration scheme uses config files
- ability to drag and drop config files to use (with or without image files)
- New use of caption page templates
- Use of target parameter in full sized links
- Now requires ACME Script Widgets
- Writes Index file as files as it goes instead of just at the end
- Allows scaling of full sized images
New in 1.5
- Can have stamped text in either upper or lower left corner
- more complete Height and Width use with clip2gif .5
- Dithering for gifs now with clip2gif .5
- Now Crops filenames that are too long
- add filename label for indexes not using tables.
- added a continue feauture for a number of errors
- checks and prompts for replacing files.
- fixed bug in making thumbnails for quicktake images
New in 1.5b3
- Quit or stay open option added
- completely rewrote the way the configure script and thumbnailer interacted because the original method was way too slow.
- Cleaned up code and improved code comments
- fixed a few more quirks
- Added support for spaces in filenames using ACME script widgets
- Added a mock real world example
New in 1.5b2
- Several bug fixes in non default configurations
- Added K stamping for thumbnails
- changed the way configure script get and sets settings now checks actual settings
- allows user to cancel out of changing setting from configure script
- added more error handling
- added the ability to have full sized images inlined on their own HTML page called a caption page
- changed name of jpeg folder from jpegs to jpgs
- Checks for quicktake image which confuse clip2gif
- Couldn't resist adding support for tables as slick image 'frames'
- will only add HSPACE and VSPACE tags if align tag is used
- Changed layout of image index
- added ability to have PICTs without .pict extension used
New in 1.5b1
- No longer requires scriptable text editor
- Added the ability to save thumbnails and fullsized images as either gif or jpeg.
- Prompts for folder to save subfolders
- Get Height and Width for gifs (thanks to Christian Nybø (http://grafisk.nhh.no/christian.html) for figuring this out.
- Added a configure script allows changing of many properties
- Ability to stamp text onto full sized images
- Use of Alt tags
- Options for dropped picts (Move, copy, leave)
- options for end action (beep, open index, nothing)
New in 1.0
- In true Applescript thanks to Yves and clip2gif
- but no control over script behavior, however it could be backgrounded
Previous to 1.0
- At this point the script was a crude hack of applescript and QuickKey script
- ugly but it got the job done, but could not be backgrounded
Preston Holmes
pholmes@ucsd.edu